<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui" template="/paginas/template.xhtml">

	<ui:define name="corpoForm">
		
		<f:event type="javax.faces.event.PreRenderComponentEvent"
			listener="#{manterPermissaoBean.preRenderNew}" />
		<h:form id="formCriarPermissao" prependId="false">

			<p:panelGrid columns="3" styleClass="botoes" id="botoes">
				<p:commandButton value="#{rsc.label_salvar}" styleClass="botao"
					action="#{manterPermissaoBean.salvar}" ajax="false"
					onclick="setTimeout('document.getElementById(\'' + this.id + '\').disabled=true;', 50);"
					rendered="#{p:ifGranted('CRIAR_PERMISSAO')}"
					title="#{rsc.title_salvar}" />

				<p:commandButton value="#{rsc.label_salvarContinuar}"
					styleClass="botao" update="growl"
					action="#{manterPermissaoBean.salvarContinuar}" ajax="false"
					onclick="setTimeout('document.getElementById(\'' + this.id + '\').disabled=true;', 50);"
					rendered="#{p:ifGranted('CRIAR_PERMISSAO')}"
					title="#{rsc.title_salvarContinuar}" />

				<p:commandButton value="#{rsc.label_cancelar}" styleClass="botao"
					update="growl" action="#{manterPermissaoBean.cancelar}"
					ajax="false"
					onclick="setTimeout('document.getElementById(\'' + this.id + '\').disabled=true;', 50);"
					title="#{rsc.title_cancelar}" immediate="true">
				</p:commandButton>

			</p:panelGrid>



			<p:panel id="pnlInfo" header="#{rsc.label_novoPermissao}"
				toggleable="true" toggleSpeed="500">

				<p:panelGrid columns="2">

					<p:outputLabel value="#{rsc.label_nomePermissao}"
						for="txtNomePermissao" styleClass="obrigatorio" />

					<p:outputLabel value="#{rsc.label_urlPermissao}"
						for="txtUrlPermissao" styleClass="obrigatorio" />

					<p:inputText label="#{rsc.label_nomePermissao}"
						id="txtNomePermissao" maxlength="60" size="40"
						title="#{rsc.label_nomePermissao}"
						value="#{manterPermissaoBean.entidade.nome}" />

					<p:inputText label="#{rsc.label_urlPermissao}" id="txtUrlPermissao"
						maxlength="50" size="41" title="#{rsc.label_urlPermissao}"
						value="#{manterPermissaoBean.entidade.url}" />

					<p:outputLabel value="#{rsc.label_role}" for="txtRolePermissao"
						styleClass="obrigatorio" />

					<p:outputLabel value="#{rsc.label_funcionalidade}:"
						for="cmbFuncionalidades" styleClass="obrigatorio" />

					<p:inputText label="#{rsc.label_role}" id="txtRolePermissao" maxlength="60"
						size="40" title="#{rsc.label_role}"
						value="#{manterPermissaoBean.entidade.role}" />


					<p:selectOneMenu styleClass="full-width"
						label="#{rsc.label_funcionalidade}"
						value="#{manterPermissaoBean.entidade.funcionalidade.id}"
						id="cmbFuncionalidades">
						<f:selectItem itemLabel="#{rsc.label_selecionar}" itemValue="" />
						<f:selectItems
							value="#{manterPermissaoBean.formulario.funcionalidades}" var="c"
							itemLabel="#{c.nome}" itemValue="#{c.id}" />
					</p:selectOneMenu>

				</p:panelGrid>
			</p:panel>
			<p:watermark value="#{rsc.wm_nomePermissao}" for="txtNomePermissao" />
			<p:watermark value="#{rsc.wm_urlPermissao}" for="txtUrlPermissao" />
			<p:watermark value="#{rsc.wm_rolePermissao}" for="txtRolePermissao" />
		</h:form>
	</ui:define>
</ui:composition>

